<!doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no viewport-fit=cover" />
		<script src="../Common/js/jump.js"></script>
		<style type="text/css">
			body {
				background-color: transparent;
			}

			#Bg {
				position: fixed;
				top: 0;
				left: 0;
				height: 100%;
				width: 100%;
			}

			@keyframes pop-window-done {
				0% {
					opacity: 0;
					width: 0;
					left: 50%;
				}
			}

			@keyframes pop-window-close {
				0% {
					opacity: 1;
					width: 80%;
					left: 10%;
				}
			}

			#PopWindow {
				position: absolute;
				bottom: 20px;
				width: 0;
				left: 50%;
				opacity: 0;
			}

			#PopWindow.done-window {
				animation: pop-window-done;
				animation-duration: 300ms;
				opacity: 1;
				width: 80%;
				left: 10%;
			}

			#PopWindow.close-window {
				animation: pop-window-close;
				animation-duration: 200ms;
				width: 0;
				left: 50%;
				opacity: 0;
			}

			#PopWindow img {
				width: 40%;
				border: 2px solid var(--color-white);
				border-radius: 5vw;
				box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
			}
		</style>
	</head>

	<body>
		<div id="Bg"></div>
		<div id="PopWindow">
					<img src="img/pop-lec.png" id="PopLec" style="float:left;" />
					<img src="img/pop-ques.png" id="PopQues" style="float:right;" />		</div>
	</body>
	<script type="text/javascript">
		document.addEventListener('plusready', function() {
			document.getElementById("PopWindow").classList.add("done-window");
			plus.webview.currentWebview().show();
		});
		document.getElementById('Bg').onclick = function() {
			ClosePopWindow();
		}
		document.getElementById('PopLec').onclick = function() {
			jumpToLec()
			ClosePopWindow();
		};
		document.getElementById('PopQues').onclick = function() {
			jumpToQues();
			ClosePopWindow();
		};
		
		function jumpToQues() {
			if (plus.webview.getWebviewById('NewQues') != null)
				plus.webview.getWebviewById('NewQues').close();
			JumpToNewQues();
		}
		
		function jumpToLec() {
			if (plus.webview.getWebviewById('NewLec') != null)
				plus.webview.getWebviewById('NewLec').close();
			JumpToNewLec();
		}

		function ClosePopWindow() {
			document.getElementById("PopWindow").classList.remove("done-window");
			document.getElementById("PopWindow").classList.add("close-window");
			setTimeout(function() {
				plus.webview.currentWebview().opener().evalJS('closePopWindow()');
			}, 200);
		}
	</script>
</html>
